package com.sangeng.task;

import com.sangeng.service.ArticleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class ViewCountUpdate {

    @Autowired
    private ArticleService articleService;

    @Scheduled(cron = "0 1/10 * * * ?")
    public void updateViewCount() {
        log.info("更新文章浏览量");
        articleService.updateViewCountToDataBase();
    }
}
